package com.ruiyian.bridge.opreations.service.impl;

import com.ruiyian.bridge.opreations.domain.TDeviceWarn;
import com.ruiyian.bridge.opreations.mapper.TDeviceWarnMapper;
import com.ruiyian.bridge.opreations.service.DeviceWarnService;
import com.ruiyian.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备报警Service业务层处理
 *
 * @author ruiyian
 * @date 2022-01-25
 */
@Service
public class TDeviceWarnServiceImpl implements DeviceWarnService
{
    @Autowired
    private TDeviceWarnMapper tDeviceWarnMapper;

    /**
     * 查询设备报警
     *
     * @param id 设备报警主键
     * @return 设备报警
     */
    @Override
    public TDeviceWarn selectTDeviceWarnById(Long id)
    {
        return tDeviceWarnMapper.selectTDeviceWarnById(id);
    }

    /**
     * 查询设备报警列表
     *
     * @param tDeviceWarn 设备报警
     * @return 设备报警
     */
    @Override
    public List<TDeviceWarn> selectTDeviceWarnList(TDeviceWarn tDeviceWarn)
    {
        return tDeviceWarnMapper.selectTDeviceWarnList(tDeviceWarn);
    }

    /**
     * 新增设备报警
     *
     * @param tDeviceWarn 设备报警
     * @return 结果
     */
    @Override
    public int insertTDeviceWarn(TDeviceWarn tDeviceWarn)
    {
        tDeviceWarn.setCreateTime(DateUtils.getNowDate());
        return tDeviceWarnMapper.insertTDeviceWarn(tDeviceWarn);
    }

    /**
     * 修改设备报警
     *
     * @param tDeviceWarn 设备报警
     * @return 结果
     */
    @Override
    public int updateTDeviceWarn(TDeviceWarn tDeviceWarn)
    {
        return tDeviceWarnMapper.updateTDeviceWarn(tDeviceWarn);
    }

    /**
     * 批量删除设备报警
     *
     * @param ids 需要删除的设备报警主键
     * @return 结果
     */
    @Override
    public int deleteTDeviceWarnByIds(Long[] ids)
    {
        return tDeviceWarnMapper.deleteTDeviceWarnByIds(ids);
    }

    /**
     * 删除设备报警信息
     *
     * @param id 设备报警主键
     * @return 结果
     */
    @Override
    public int deleteTDeviceWarnById(Long id)
    {
        return tDeviceWarnMapper.deleteTDeviceWarnById(id);
    }
}
